rm(list=ls())

library(spatstat)
library(plyr)
library(lattice)

source("set_up.R", encoding = "UTF-8")

# ## Load newly created data from working directory
load('ppm_data_new_afo_r5.RData')

ged.postsurv.r80 <- unmark(ged.postsurv.r80) # after 2018
ged.postsurv.r50 <- unmark(ged.postsurv.r50) # after 2018

log_pop.im <- log(pop.im +1)

r5_r80 <- ppm(ged.postsurv.r80 ~ internet_freq.im + log_pop.im+ light.im  + 
                elev.im + urban.im)


r5_r50 <- ppm(ged.postsurv.r50 ~  internet_freq.im + log_pop.im+ light.im  + 
                elev.im + urban.im)


save(r5_r50, r5_r80, file = "ppmoutcome_r5.RData")

